using MultiAxisAssembly;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using ZRFCore.CodeSafe;
using ZRFCore.ToolForm;

namespace 喷点胶机
{
    internal static class Program
    {
        /// <summary>
        ///  The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.SetHighDpiMode(HighDpiMode.SystemAware);
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            string? str = System.Diagnostics.Process.GetCurrentProcess().MainModule?.FileName;
            if (str != null)
            {
                Console.WriteLine(str);
            }
            if (System.Diagnostics.Process.GetProcessesByName("喷点胶机").Length > 1)
            {

                MessageBox.Show("程序已打开！", "消息", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                Application.Exit();
                return;
            }

            CheckHardwareInfo.CheckCpuSerialNum();

            ControlMaster controlMaster = new ControlMaster();
            try
            {
                Application.Run(new LoadSystemForm(controlMaster.Init));
                Application.Run(new Form1(controlMaster));
            }
            catch 
            {
                controlMaster.Close();
            }
            
        }
    }
}
